package com.huashi.dealer.modular.business.order.param;

import com.huashi.dealer.commonEntity.GoodsSku;
import com.huashi.dealer.commonEntity.UserAddress;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 * 购物车订单预览返回参数
 * 对应PHP项目/order/cart接口的返回数据结构
 *
 * @author 谭陈强
 * @since 2025-08-15
 */
@Data
@Schema(description = "购物车订单预览返回参数")
public class CartOrderPreviewResponseParam {

    @Schema(description = "商品列表")
    private List<CartGoodsInfo> goodsList;

    @Schema(description = "满赠商品列表")
    private List<Object> marketGoodsList;

    @Schema(description = "商品总数量")
    private Integer orderTotalNum;

    @Schema(description = "优惠券列表")
    private List<Object> couponList;

    @Schema(description = "是否有错误")
    private Boolean hasError;

    @Schema(description = "错误信息")
    private String errorMsg;

    @Schema(description = "配送类型")
    private Integer delivery;

    @Schema(description = "默认收货地址")
    private UserAddress address;

    @Schema(description = "是否存在收货地址")
    private Boolean existAddress;

    @Schema(description = "配送费用")
    private BigDecimal expressPrice;

    @Schema(description = "当前用户收货城市是否存在配送规则中")
    private Boolean intraRegion;

    @Schema(description = "自提门店信息")
    private Object extractShop;

    @Schema(description = "是否允许使用积分抵扣")
    private Boolean isAllowPoints;

    @Schema(description = "是否使用积分抵扣")
    private Boolean isUsePoints;

    @Schema(description = "积分抵扣金额")
    private BigDecimal pointsMoney;

    @Schema(description = "赠送的积分数量")
    private Integer pointsBonus;

    @Schema(description = "支付方式")
    private Integer payType;

    @Schema(description = "系统设置")
    private SystemSetting setting;

    @Schema(description = "记忆的自提联系方式")
    private Object lastExtract;

    @Schema(description = "满减设置")
    private Object fullFree;

    @Schema(description = "订单总金额（不含优惠折扣）")
    private BigDecimal orderTotalPrice;

    @Schema(description = "订单实际付款金额")
    private BigDecimal orderPayPrice;

    @Schema(description = "优惠券抵扣金额")
    private BigDecimal couponMoney;

    @Schema(description = "会员折扣金额")
    private BigDecimal gradeMoney;

    /**
     * 购物车商品信息
     */
    @Data
    @Schema(description = "购物车商品信息")
    public static class CartGoodsInfo {

        @Schema(description = "商品ID")
        private Long goodsId;

        @Schema(description = "barCode")
        private String barCode;

        @Schema(description = "商品名称")
        private String goodsName;

        @Schema(description = "商品图片")
        private String goodsImage;

        @Schema(description = "商品SKU ID")
        private Long goodsSkuId;

        @Schema(description = "商品规格")
        private GoodsSku goodsSku;

        @Schema(description = "商品单价")
        private BigDecimal goodsPrice;

        @Schema(description = "购买数量")
        private Integer totalNum;

        @Schema(description = "商品总价")
        private BigDecimal totalPrice;

        @Schema(description = "是否活动商品")
        private Integer isActiveGoods;

        @Schema(description = "活动价格")
        private BigDecimal activePrice;

        @Schema(description = "起订量")
        private Integer setNum;

        @Schema(description = "活动信息")
        private Object activeInfo;

        @Schema(description = "活动阶梯价格")
        private List<Object> activeDiscount;

        @Schema(description = "优惠券抵扣金额")
        private BigDecimal couponMoney;

        @Schema(description = "积分抵扣金额")
        private BigDecimal pointsMoney;

        @Schema(description = "会员折扣金额")
        private BigDecimal gradeMoney;

        @Schema(description = "实际付款金额")
        private BigDecimal totalPayPrice;

        @Schema(description = "购物车创建时间")
        private Long cartCreateTime;
    }

    /**
     * 系统设置
     */
    @Data
    @Schema(description = "系统设置")
    public static class SystemSetting {

        @Schema(description = "支持的配送方式")
        private List<Integer> delivery;

        @Schema(description = "积分名称")
        private String pointsName;

        @Schema(description = "积分说明")
        private String pointsDescribe;

        @Schema(description = "订阅消息")
        private List<String> orderSubmsg;
    }
}
